<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>选择学员</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
        var parentUserSelect  = [];
        var selectedUserFromBox = [];
		$(document).ready(function() {
			$("input[name=id]").each(function(){
				var userSelect = parentUserSelect;
				for (var i=0; i<userSelect.length; i++){
					if (userSelect[i][0]==$(this).val()){
						this.checked = true;
					}
				}
				$(this).click(function(){
					var id = $(this).val(), title = $(this).attr("title");
                    userSelectAddOrDelByBox(id,title);
				});
			});
		});
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").submit();
        	return false;
        }

        function userSelectAddOrDelByBox(id,title){
            selectedUserFromBox.push([id,title]);
        }
	</script>
</head>
<body>
	<div style="margin:10px;">
	<form:form id="searchForm" modelAttribute="userCourse" action="${ctx}/cms/userCourse/selectList" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
        <div>
            <label>学员归类：</label>
            <form:select id="remarks" path="remarks" class="input-medium">
                <form:option value="" label="-- 全部 --"/>
                <form:options items="${fns:getDictList('course_category_name')}" itemLabel="label" itemValue="value" htmlEscape="false"/></form:select>
            &nbsp;&nbsp;
            <label>学员ID：</label><input id="id" name="id" type="text" maxlength="50" class="input-mini" value="${userCourse.id}"/>
        </div>
        <div style="margin-top:8px;">
        <label>日期范围：&nbsp;</label><input id="beginDate" name="beginDate" type="text" readonly="readonly" maxlength="20" class="input-mini Wdate"
                                         value="<fmt:formatDate value="${userCourse.beginDate}" pattern="yyyy-MM-dd"/>" onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});"/>
        <label>&nbsp;--&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label><input id="endDate" name="endDate" type="text" readonly="readonly" maxlength="20" class="input-mini Wdate"
                                                                    value="<fmt:formatDate value="${userCourse.endDate}" pattern="yyyy-MM-dd"/>" onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});"/>
        &nbsp;&nbsp;&nbsp;<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>&nbsp;&nbsp;
    </div>
	</form:form>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead><tr><th style="text-align:center;">选择</th><th>学员ID</th><th>学员昵称</th><th>学员归类</th><th>注册时间</th></tr></thead>
		<tbody>
		<c:forEach items="${page.list}" var="userCourse">
			<tr>
				<td style="text-align:center;"><input type="radio" name="id" value="${userCourse.id}" title="${fns:abbr(userCourse.name,40)}" /></td>
                <td>${userCourse.id}</td>
                <td>${userCourse.name}</td>
                <td>${userCourse.remarks}</td>
                <td>
                    <fmt:formatDate value="${userCourse.createDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
                </td>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
	</div>
</body>
</html>